package edu.sctu.yueding.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.xys.libzxing.zxing.activity.CaptureActivity;

import edu.sctu.yueding.R;

/**
 * Created by 鑫爷您慢点 on 2016/8/3.
 */
public class ScanActivity extends BaseActivity{

    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.qr_test);

        textView = (TextView) findViewById(R.id.text_result);
    }

    public void scan(View view){

        startActivityForResult(new Intent(ScanActivity.this,CaptureActivity.class),0);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode == RESULT_OK){
            Bundle bundle = data.getExtras();
            String result = bundle.getString("result");
            textView.setText(result);

        }
    }
}
